package com.noyes4j.ota.service.impl;

import com.noyes4j.common.core.text.Convert;
import com.noyes4j.common.utils.DateUtils;
import com.noyes4j.ota.domain.SysProduce;
import com.noyes4j.ota.mapper.SysProduceMapper;
import com.noyes4j.ota.service.ISysProduceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 产品Service业务层处理
 *
 * @author noyes4j
 * @date 2021-01-29
 */
@Service
public class SysProduceServiceImpl implements ISysProduceService {

    @Autowired
    private SysProduceMapper sysProduceMapper;

    /**
     * 查询产品
     *
     * @param id 产品ID
     * @return 产品
     */
    @Override
    public SysProduce selectSysProduceById(Long id)
    {
        return sysProduceMapper.selectSysProduceById(id);
    }

    /**
     * 查询产品列表
     *
     * @param sysProduce 产品
     * @return 产品
     */
    @Override
    public List<SysProduce> selectSysProduceList(SysProduce sysProduce)
    {
        return sysProduceMapper.selectSysProduceList(sysProduce);
    }

    /**
     * 新增产品
     *
     * @param sysProduce 产品
     * @return 结果
     */
    @Override
    public int insertSysProduce(SysProduce sysProduce)
    {
        sysProduce.setCreateTime(DateUtils.getNowDate());
        return sysProduceMapper.insertSysProduce(sysProduce);
    }

    /**
     * 修改产品
     *
     * @param sysProduce 产品
     * @return 结果
     */
    @Override
    public int updateSysProduce(SysProduce sysProduce)
    {
        sysProduce.setUpdateTime(DateUtils.getNowDate());
        return sysProduceMapper.updateSysProduce(sysProduce);
    }

    /**
     * 删除产品对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysProduceByIds(String ids)
    {
        return sysProduceMapper.deleteSysProduceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除产品信息
     *
     * @param id 产品ID
     * @return 结果
     */
    @Override
    public int deleteSysProduceById(Long id)
    {
        return sysProduceMapper.deleteSysProduceById(id);
    }

}
